/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.jm.financeiro.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/**
 *
 * @author joao
 */
@Entity
@Table(name = "log_sistema", catalog = "salao", schema = "public")
@NamedQueries({
    @NamedQuery(name = "LogSistema.findAll", query = "SELECT l FROM LogSistema l")})
public class LogSistema implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "log_sistema_id_log_seq")
    @SequenceGenerator(name = "log_sistema_id_log_seq", sequenceName = "log_sistema_id_log_seq", initialValue = 1, allocationSize = 1)
    @Basic(optional = false)
    @Column(name = "id_log", nullable = false)
    private Integer idLog;
    @Column(name = "dat_update")
    @Temporal(TemporalType.DATE)
    private Date datUpdate;
    //@OneToMany(mappedBy = "idLog")
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idLog")
    @LazyCollection(LazyCollectionOption.FALSE)
    @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    private List<LogSistemaDetalhe> logSistemaDetalheList;
    
    @Transient
    private String dscUsuario;
    @Transient
    private String dscSistema;
            

    public LogSistema() {
    }

    public LogSistema(Integer idLog) {
        this.idLog = idLog;
    }

    public Integer getIdLog() {
        return idLog;
    }

    public void setIdLog(Integer idLog) {
        this.idLog = idLog;
    }

    public Date getDatUpdate() {
        return datUpdate;
    }

    public void setDatUpdate(Date datUpdate) {
        this.datUpdate = datUpdate;
    }

    public List<LogSistemaDetalhe> getLogSistemaDetalheList() {
        return logSistemaDetalheList;
    }

    public void setLogSistemaDetalheList(List<LogSistemaDetalhe> logSistemaDetalheList) {
        this.logSistemaDetalheList = logSistemaDetalheList;
    }

    public String getDscUsuario() {
        return dscUsuario;
    }

    public void setDscUsuario(String dscUsuario) {
        this.dscUsuario = dscUsuario;
    }

    public String getDscSistema() {
        return dscSistema;
    }

    public void setDscSistema(String dscSistema) {
        this.dscSistema = dscSistema;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLog != null ? idLog.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LogSistema)) {
            return false;
        }
        LogSistema other = (LogSistema) object;
        return !((this.idLog == null && other.idLog != null) || (this.idLog != null && !this.idLog.equals(other.idLog)));
    }

    @Override
    public String toString() {
        return "br.jm.financeiro.entity.LogSistema[ idLog=" + idLog + " ]";
    }
    
}
